uDig

«  Working with Features   ::   Contents   ::   Changing the projection of a shapefile  »

Adding a column to a shapefile

You can use the Transform operation to generate additional attributes and then export the resulting scratch layer.

  1. Select the contents of your shape file:
    • Exapand the shapefile entry in the catalog view and select the contents
    • Select the layer (if you happen to have the shape file on screen)
  2. Run the Transform operation:
    • Right click to bring up the context menu and choose Operations > Transform
    • From the menu bar Edit ‣ All Operations to open the Operations dialog then select Resource ‣ Transform and press Operate
  3. This operation will open the Transform dialog listing the current attributes along with a definition of how to populate them.
  4. Select where you would like to add an attribute
  5. Press the Add button to create a new entry
  6. Fill in the name of your new Attribute
  7. Fill in the Expression viewer to define the values for your new attribute.
  8. Choose how you would like to handle the result: Add to Catalog
    • Add to Map: can be used when processing a layer, in addition to adding to the catalog the result is immediately added to the Map as a preview.
    • Add to Catalog: the results are saved into the Scratch working area
  9. Press OK to start the transform
    • A new Scratch entry containing the result of the operation has been added to the scratch service in the Catalog view.
  10. Right click on the above scratch entry in the catalog view and select Export to open the Export Wizard
  11. Choose Resource to Shapefile and press Next>
  12. Provide a destination directory for your new shapefile
  13. Ensure that your scratch entry is checked off for export
  14. Press Finish
  15. The new shapefile is now available in the Catalog view

You can define additional columns using any CQL expression, please be advised that the shapefile format can only support one geometry column.

Related concepts

Constraint Query Language

Related reference

Transform operation

Catalog view

Resource to Shapefile Wizard

«  Working with Features   ::   Contents   ::   Changing the projection of a shapefile  »